package com.gxa.mobile.config;

import com.gxa.mobile.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author lch
 * @Date 2024/3/26 16:53
 * @Description 拦截器配置
 **/
//@Configuration
public class MyMvcConfigure implements WebMvcConfigurer {

    @Bean
    public LoginInterceptor loginInterceptor(){
       return new LoginInterceptor();
    }

    //配置拦截器
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").
                excludePathPatterns("/swagger-resources/**","/webjars/**","/v2/**","/swagger-ui.html/**");
    }

}
